/*
 * IGeometryFactory
 * 
 * initial implementation : 20.9.2008
 *
 * Copyright (c) Adam Sida, asida@centrum.cz.
 * All rights reserved.
 * 
 * for license see Petra.Gis.License.txt
 */
using System;
using System.Collections.Generic;
using System.Text;
using Petra.Gis.Geometry;

namespace Petra.Gis.DataServices
{
  /***************************************
   * 
   * this interface must be implemented
   * by any data provider who wants
   * to produce geometries
   * 
   **************************************/
  /// <summary>
  /// this IGeometryFactory interface is generic for all type of geometry perisit formats
  /// each specific geometry factory must ensure that
  /// 'object' is of proper System.type
  /// eg. WKB needs byte[] or stream as input and output
  /// </summary>
  public interface IGeometryFactory
  {

    /// <summary>
    /// function that creates <c>GeometryBase</c> object from geometry storage format
    /// </summary>
    /// <param name="vdata">input storage format, such as byte[], string,...</param>
    /// <returns>new GeometryBase instance</returns>
    GeometryBase CreateGeometry(object vdata);



    /// <summary>
    /// probe function that can be used to determine if particular geometry
    /// can save into storrage format
    /// </summary>
    /// <param name="geometry"></param>
    /// <returns></returns>
    bool CanSave(GeometryBase geometry);



    /// <summary>
    /// function that converts <c>GeometryBase</c> back into
    /// particular storage format
    /// </summary>
    /// <param name="geometry">geometry object</param>
    /// <returns>geometry converted to storage format</returns>
    object SaveGeometry(GeometryBase geometry);
    
  }

}
